cmake_minimum_required(VERSION 3.2)

project(quarkts_static_example)

# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find the QuarkTS static library
find_library(QUARKTS_LIBRARY
    NAMES quarkts-cpp
    PATHS ${CMAKE_SOURCE_DIR}/../build/lib
          ${CMAKE_SOURCE_DIR}/../../build/lib
          /usr/local/lib
          /usr/lib
)

# Find the include directory
find_path(QUARKTS_INCLUDE_DIR
    NAMES include/timer.hpp
    PATHS ${CMAKE_SOURCE_DIR}/..
          ${CMAKE_SOURCE_DIR}/../..
          /usr/local/include
          /usr/include
)

if(NOT QUARKTS_LIBRARY)
    message(FATAL_ERROR "QuarkTS library not found. Please build the library first.")
endif()

if(NOT QUARKTS_INCLUDE_DIR)
    message(FATAL_ERROR "QuarkTS include directory not found.")
endif()

message(STATUS "Found QuarkTS library: ${QUARKTS_LIBRARY}")
message(STATUS "Found QuarkTS includes: ${QUARKTS_INCLUDE_DIR}")

# Create executable that uses the static library
add_executable(static_library_example main.cpp)

target_include_directories(static_library_example PRIVATE ${QUARKTS_INCLUDE_DIR}/src)
target_link_libraries(static_library_example ${QUARKTS_LIBRARY})